import React, { Component } from 'react'
import PropTypes from 'prop-types'

import Item from '../Item/Item'

import './List.css'


export default class List extends Component {
    render() {
        const {todos, updateTodo} = this.props
        return (
            <ul className="todo-main">
                {
                   todos.map((todo) => {
                       {/*return <Item key={todo.id} id={todo.id} name={todo.name} done={todo.done}/>*/}
                       return <Item key={todo.id} {...todo} updateTodo={updateTodo}/>
                   })
                }
            </ul>
        )
    }

    static propTypes = {
        addTodo: PropTypes.func.isRequired
    }
}
